<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
<title></title>

<script type="text/javascript">

function asignaAccion(accClic){
	if(accClic.name =="btnBuscaCP"){
		if(document.forms[0].codcp.value != ''){
			document.formBusq.operacion.value="buscarSolCP";
			document.formBusq.action="SolServlet.do";
		}else{
			document.forms[0].codcp.focus();
			return alert('Ingrese el codigo de comprobante de pago');
		}
	}else if(accClic.name =="btnBuscaCN"){
		if(document.forms[0].codcont.value != ''){
			document.formBusq.operacion.value="buscarSolCN";
			document.formBusq.action="SolServlet.do";
		}else{
			document.forms[0].codcont.focus();
			return alert('Ingrese el codigo del contribuyente');
		}
	}else if(accClic.name =="btnListar"){
	document.formBusq.operacion.value="listaTodo";	
	document.formBusq.action="SolServlet.do";
	}else if(accClic.name=="linkSol"){
	document.formBusq.operacion.value="irSolicitud";	
	document.formBusq.action="SolServlet.do";
	}
	document.formBusq.submit();

	}
	function deshabilitaBT(campo){
		if(campo.name == 'codcont'){
			document.forms[0].btnBuscaRP.disabled = true;
			document.forms[0].btnBuscaC.disabled = false;
		}
		if(campo.name == 'codcp'){
			document.forms[0].btnBuscaRP.disabled = false;
			document.forms[0].btnBuscaC.disabled = true;
		}
	}
</script>

</head>
<body >
<form name="formBusq" method="post" action="">
  <table border="2" cellpadding="8">
    <tr bgcolor="#FF6600">
      <td colspan="3" class="HeaderColor">
       
        <h4><fmt:message key="cu021.titBusSol" /></h4>
        
      </td>
    </tr>
	<tr bgcolor="#C0C0C0">
      <td colspan="3" class="HeaderColor">
        <fmt:message key="cu021.titOpBus" />   
      </td>
    </tr>
    <tr >
      <td bgcolor="#DDDDDD" width="12%" nowrap class="LabelColor" style="text-align: right">
        <label for="codreci"> <fmt:message key="cu021.codComPag" />  </label>
      </td>
      <td bgcolor="#DDDDDD" width="50%" class="TitleColor">
        <input type="text" id="codcp" name="codcp"  size="35" onfocus="deshabilitaBT(this);">
        <br>
      </td>
      <td bgcolor="#DDDDDD" width="50%" class="TitleColor">
        <input type="button" id="btnBuscaRP" name="btnBuscaCP" size="35" value=<fmt:message key="cu021.btnBuscar" /> onclick=asignaAccion(this)>
        <br>
      </td>
       </tr>
 <!-- </table>
      </form>
 <form name="form2" method="post" action="SolServlet.do">
  <table border="2" cellpadding="8">  --> 
    <tr  style="vertical-align: top">
      <td bgcolor="#DDDDDD" style="text-align: right; width: 209px" class="LabelColor"><label for="codcont"> <fmt:message key="cu021.codContr" /></label>
      </td>
      <td bgcolor="#DDDDDD" width="50%" class="TitleColor" style="width: 287px">
        <input type="text" id="codcont" name="codcont" size="35" onfocus="deshabilitaBT(this);">
      </td>
      <td bgcolor="#DDDDDD" width="50%" class="TitleColor">
        <input type="button" id="btnBuscaC" name="btnBuscaCN" size="35" value=<fmt:message key="cu021.btnBuscar" /> onclick=asignaAccion(this)>
        <br>
      </td>
    </tr>
<!-- </table>
      </form>
       <form name="form3" method="post" action="SolServlet.do">
  <table border="2" cellpadding="8"> -->   
    <tr bgcolor="#C0C0C0"> 
        <td bgcolor="#DDDDDD" colspan="3" class="TitleColor">
        <input type="button" id="btnListar" name="btnListar" size="35" value=<fmt:message key="cu021.btnListaTodo" /> onclick=asignaAccion(this)>
        <br>
      </td>
    </tr>
    <tr bgcolor="#C0C0C0">
      <td colspan="3" class="HeaderColor">
       <fmt:message key="cu021.titSoli" />   
      </td>
    </tr>
    <tr bgcolor="#DDDDDD" style="vertical-align: top">
 		<td colspan="3">
 		
		<table width="700" border="3" id="tbLiq">
  <tr bgcolor="00D0E8">
  	<th scope="col"><div align="center"><em><strong><fmt:message key="cu021.tablCodSol" />   </strong></em></div></th>
    <th scope="col"><div align="center"><em><strong><fmt:message key="cu021.tablFecCrea" />  </strong></em></div></th>
    <th scope="col"><div align="center"><em><strong><fmt:message key="cu021.tablCodCont" /> </strong></em></div></th>
    <th scope="col"><div align="center"><em><strong><fmt:message key="cu021.tablNomCom" />  </strong></em></div></th>
    <th scope="col"><div align="center"><em><strong><fmt:message key="cu021.tablVerDeta" />  </strong></em></div></th>
  </tr>
  <c:if test="${requestScope.listaSolicitud!=null}">
   <c:forEach var="sol" items="${requestScope.listaSolicitud}" varStatus="st" >
  <tr bgcolor="#FFFFFF">
    <td>${sol.strCodSol} </td>
    <td>${sol.dtFcCreacion}</td>
    <td>${sol.strCodContrib}</td>
    <c:if test="${sol.strRazSocContrib!=null}">
    <td>${sol.strRazSocContrib}</td>
    <td align="center"><a href="SolServlet.do?operacion=irSolicitud&codigoSol=${sol.strCodSol}&codCont=${sol.strCodContrib}&nomC=${sol.strRazSocContrib}" name="linkSol" onclick=asignaAccion(this)> <fmt:message key="cu021.tablDetalle" /> </a> </td>
    </c:if>
     <c:if test="${sol.strRazSocContrib==null}">
    <td>${sol.strNombreContrib} ${sol.strApelliPatContrib} ${strApelliMatContrib}</td>
    <td align="center"><a href="SolServlet.do?operacion=irSolicitud&codigoSol=${sol.strCodSol}&codCont=${sol.strCodContrib}&nomC=${sol.strNombreContrib} ${sol.strApelliPatContrib} ${strApelliMatContrib}" name="linkSol" onclick=asignaAccion(this)> <fmt:message key="cu021.tablDetalle" /> </a> </td>
    </c:if>
  </tr>
  </c:forEach>
  </c:if>
</table>
		</td>
    </tr>
  </table>
  <input type="hidden" name="operacion">
</form>
</body>
</html>
    